<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<input type="text">

<script>
let input = document.getElementsByTagName('input')[0]

let timer
input.oninput = function(){
    clearTimeout(timer)
    timer = setTimeout(function(){
        console.log(input.value)
    },300)
}

// 1、函数防抖：确保函数在一定时间内不再被调用时触发    应用：输入框
</script>
</body>
</html>